import 'package:fish_redux/fish_redux.dart';
import 'package:member_center_sdk_example/models/member.dart';

class MemberCenterState implements Cloneable<MemberCenterState> {
  bool isLoading = true;
  bool isNoLogin= false;
  bool loadErr= false;
  int memberId;
  String userName;
  String avatarUrl;
  String nickName;
  String email;
  bool hasPassword;

  @override
  MemberCenterState clone() {
    return MemberCenterState()
      ..userName = userName
      ..avatarUrl = avatarUrl
      ..nickName = nickName
      ..email = email
      ..memberId = memberId
      ..isLoading = isLoading
      ..isNoLogin = isNoLogin
      ..loadErr = loadErr;
  }
}

MemberCenterState fromMember(Member member) {
  return MemberCenterState()
    ..userName = member.userName
    ..avatarUrl = member.avatarUrl
    ..nickName = member.nickName
    ..email = member.email
    ..memberId = member.memberId
    ..isLoading = false
    ..isNoLogin = false
    ..loadErr = false;
}

MemberCenterState initState(Map<String, dynamic> args) {
  return MemberCenterState();
}
